psp-httpd 0.6

Created by Elxx
http://elxx.net
________________

What is LHP?

LHP, short for Lua Hypertext Preprocessor, is a server-side implementation of the Lua/LuaPlayer language that can be used to create dynamic web pages that run on psp-httpd. It aims to allow complete integration of Lua into web pages to enhance them as PHP does on Apache servers.

_________________________________________

Using LHP

To insert Lua code into your pages, the file extension must be .lhp.

Then, to embed code, add a line that reads
<?
with nothing else. After this line, you may enter all your Lua code. Then, add
?>
to end the code. This is the point at which the code will be parsed.

You can add multiple instances of this code into a single page.

_________________________________________

LHP Functions

All of the default Lua and LuaPlayer functions are available in LHP, including scripts that write data to the PSP's screen, edit files, etc. It is highly recommended for security reasons that you do not allow public uploading of LHP files.

In addition, certain functions have been added to the psp-httpd implementation to fit hypertext pages.

----

echo(string text)

Adds the string to psp-httpd output.

----

graphicsPrint(string text)

Prints a string on the server console on the PSP screen. \n will create a newline, \1 through \5 will change the colour of the string.

----

(Not many functions here, ehh? Well, this is just a beta so more will be added later.)

_________________________________________

LHP Internal Tables

Variables from the browser's GET and POST requests are also parsed and passed into the LHP parser for use in scripts.

----

_get.varname

Returns the variable [varname] from the browser's GET request. (ex: http://ip.to.the.psp/LHP/script.lhp?varname=5)

----

_post.varname

Returns the variable [varname] from the browser's POST request. (such as when sending a form with the method POST)

----

_post.file[1]

Returns the name of a file sent in a multipart/form-data POST request.

_post.file[2]

Returns the contents of a file sent in a multipart/form-data POST request.

----

_________________________________________

LHP Error Handling

If an error occurrs in your script, the LHP parser will return the error message returned by pcall(). You may use your own error handler if you wish to insert one into your script.

_________________________________________

Notes

Editing your LHP scripts while the server is running is not recommended. Usually, your changes will not work correctly until the server is restarted.